package fangfa;
//设计一个方法。用于数组遍历，要求遍历的结果是在一行上的。例如：[11, 22, 33, 44, 55]
public class test5 {
    public static void main(String[] args) {
     //qwe();错了
        //定义数组
        int [] arr ={11,22,33,44,55};
        qwe(arr);
    }
    /*public static int qwe(){
        int [] arr ={11,22,33,44,55};
        for(int i = 0; i<arr.length ; i++){
            int temp=arr[i];
            System.out.print(temp + " ");
        }
        return 0;*/
       public static void qwe(int [] arr){
           System.out.print("[");
           for(int i = 0; i<arr.length; i++){
               if(i == arr.length-1){
                   System.out.print(arr[i]);
               }else{
                   System.out.print(arr[i]+", ");
               }
           }
           System.out.print("]");
       }

    }

